package com.lb.bs.client.processor.beans;

import com.lb.bs.client.processor.enums.ProcessorType;

/**
 * program: LB-BS-Client
 * author: bsworld.xie
 * create: 2019-12-11 09:52
 * description:
 */
public class ProcessorBean<T> {

    private T t;

    private ProcessorType processorType;

    private boolean async = false;

    public ProcessorBean(T t, ProcessorType processorType) {
        this.t = t;
        this.processorType = processorType;
    }

    public ProcessorBean(Builder<T> builder) {
        this.t = builder.t;
        this.processorType = builder.processorType;
        this.async = builder.async;
    }

    public T getT() {
        return t;
    }


    public ProcessorType getProcessorType() {
        return processorType;
    }

    public boolean getAsync() {
        return async;
    }

    public static <T> Builder<T> builder() {

        return new Builder<>();
    }


    public static class Builder<T> {
        private T t;

        private ProcessorType processorType;

        private boolean async = false;

        public Builder<T> data(T t) {
            this.t = t;
            return this;
        }

        public Builder<T> processorType(ProcessorType processorType) {
            this.processorType = processorType;
            return this;
        }

        public Builder<T> async(boolean async) {
            this.async = async;
            return this;
        }

        public ProcessorBean<T> build() {

            return new ProcessorBean(this);
        }
    }
}
